/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.vfi.beans;

import edu.upn.sigemfi.vfi.bc.ChequeDelegate;

import edu.upn.sigemfi.vfi.be.Cheque;


import java.util.List;

/**
 *
 * @author Programador
 */
public class ChequeController {

    private ChequeDelegate delegado;
    private Cheque cheque;

    public ChequeController() {
        delegado = new ChequeDelegate();
    }

    public List<Cheque> getCheques() {
        try {
            return delegado.listar();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    public String nuevo() {
        cheque = new Cheque();
        return "nuevo";
    }
    public String registrar() {
        try {
            delegado.crear(cheque);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "volver";
    }

    public Cheque getCheque() {
        return cheque;
    }
    public void setCheque(Cheque cheque) {
        this.cheque = cheque;
    }

}
